﻿using System;
using Thuoc24h.Business;
using Thuoc24h.Common;

namespace Thuoc24h.AdminCP.Pages
{
    public partial class InvoicesDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["ID"].ToInt32Return0();
            if (!Page.IsPostBack)
            {
                var invoice = ReviewRepository.GetInvoiceById(id);

                ltrBuyerName.Text = invoice.BuyerName;
                ltrReceiverName.Text = invoice.ReceiverName;
                ltrBuyerEmail.Text = invoice.BuyerEmail;
                ltrReceiverEmail.Text = invoice.ReceiverEmail;

                ltrBuyerPhone.Text = invoice.BuyerPhone;
                ltrReceiverPhone.Text = invoice.ReceiverPhone;

                ltrBuyerAddress.Text = invoice.BuyerAddress;
                ltrReceiverAddress.Text = invoice.ReceiverAddress;
                ltrReceiveDate.Text = invoice.ReceiveDate.ToString();
                ltrBuyerDate.Text = invoice.CreatedDate.ToString();
                ltrNote.Text = invoice.Note;
                ltrStatus.Text = invoice.Status == 1 ? "Đã thanh toán" : "Chưa thanh toán";
            }
        }
    }
}